<template>
	<div>
		<el-table :data="tabledata">
			<el-table-column label="车位号码" prop="number"></el-table-column>
			<el-table-column label="车位状态" prop="status"></el-table-column>
			<el-table-column label="车位类型" prop="typeName"></el-table-column>
			<el-table-column label="更新时间" prop="updateTime"></el-table-column>
		</el-table>
		<el-pagination layout="prev, pager, next" :page-size="15" :total="totalsize" @current-change="changepage"></el-pagination>
	</div>
</template>

<script>
	import {getparkinglist} from '../api.js'
	export default{
		data() {
			return {
				tabledata:[],
				totalsize:0
			}
		},
		
		mounted() {
			this.mygetparkinglist(1,15);
		},
		
		methods: {
			
			changepage(page)
			{
				this.mygetparkinglist(page,15);
				
			},
			mygetparkinglist(page,size) {
				
				let params={
					currentPage:page,
					pageSize:size,
					parkId:'ee74db57b0e947f8b9d49bbf0011b6a3'
				}
				getparkinglist(params).then((res)=>{
					let result = res.data;
					console.log(result);
					this.tabledata=result.data;
					this.totalsize=result.totalSize;
					
					for(let i =0;i<this.tabledata.length;i++)
					{
						if(this.tabledata[i].status=="EXIST_CAR")
						{
							this.tabledata[i].status="有车"
						}
						if(this.tabledata[i].status=="EMPTY")
						{
							this.tabledata[i].status="空闲"
						}
						
						
					}
				})
				
			}
		},
	}
</script>

<style>
</style>
